import request from '@/utils/request'

const stock = {

  getWarehouseAllAPI: function () {
    return request({
      url: '/eims/warehouse/list',
      method: 'get'
    })
  },
  getWarehouseListAPI: function (params) {
    return request({
      url: '/eims/warehouse/list',
      method: 'post',
      data: params
    })
  },
  addWarehouseAPI: function (params) {
    return request({
      url: '/eims/warehouse/add',
      method: 'post',
      data: params
    })
  },
  updateWarehouseAPI: function (params) {
    return request({
      url: '/eims/warehouse/update/' + params.id,
      method: 'put',
      data: params
    })
  },
  deleteWarehouseAPI: function (id) {
    return request({
      url: '/eims/warehouse/delete/' + id,
      method: 'delete',
      data: {}
    })
  },
  getProductInventoryListAPI: function (params) {
    return request({
      url: '/eims/stock/inventory/list',
      method: 'post',
      data: params
    })
  },
  updateProductInventoryAPI: function (params) {
    return request({
      url: '/eims/stock/inventory/update/' + params.id,
      method: 'put',
      data: params
    })
  },
  getProductStorageListAPI: function (params) {
    return request({
      url: '/eims/stock/storage/list',
      method: 'post',
      data: params
    })
  },
  /**
   *  订单入库记录
   * @param {*} associateOrder
   * @returns
   */
  getProductStorageByAssociateOrderAPI: function (associateOrder) {
    return request({
      url: '/eims/stock/storage/list/' + associateOrder,
      method: 'get'
    })
  },
  addProductStorageAPI: function (params) {
    return request({
      url: '/eims/stock/storage/add',
      method: 'post',
      data: params
    })
  },
  getProductDeliveryListAPI: function (params) {
    return request({
      url: '/eims/stock/delivery/list',
      method: 'post',
      data: params
    })
  },
  /**
   *  订单出库记录
   * @param {*} associateOrder
   * @returns
   */
  getProductDeliveryByAssociateOrderAPI: function (associateOrder) {
    return request({
      url: '/eims/stock/delivery/list/' + associateOrder,
      method: 'get'
    })
  },
  addProductDeliveryAPI: function (params) {
    return request({
      url: '/eims/stock/delivery/add',
      method: 'post',
      data: params
    })
  },
  getProductStockLocked: function (params) {
    return request({
      url: '/eims/stock/locked/list/' + params.warehouseCode + '/' + params.productCode,
      method: 'get'
    })
  }
}

export default stock
